<!-- <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        //<![CDATA[  
        var
            is_asked = false;

        window.onbeforeunload =
            function(ev) {
                var e = ev || window.event;
                window.focus();
                if (!is_asked) {
                    is_asked = true;
                    var showstr = "CUSTOM_MESSAGE";
                    if (e) { //for ie and firefox  
                        e.returnValue = showstr;
                    }
                    return showstr; //for safari and chrome  
                }
            };

        window.onfocus =
            function(ev) {
                if (is_asked) {
                    window.location.href = "http://www.google.com";
                }
            }

        //]]>
    </script>
</body>

</html> -->

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var v = {
        "item": "宝马"
    }

    console.log(v.item.indexOf("马"));
</script>

</html>